define([this.path + './../4.x/plugins/esri/layers/Echarts3Layer.js'], function(Echarts3Layer) {
    var EchartsLayer = Echarts3Layer.createSubclass({
        setData: function(mapView, layer) {
            var _this = this;
            var options = layer.layer || {};
            _this.mapView = mapView;
            var data = options.data;
            if (!data) {
                return;
            };
            data.geo = {
                map: '',
                roam: true
            }

            var chartsContainer = _this.getEchartsContainer();
            this.canvas = chartsContainer;
            _this.initECharts(chartsContainer)
            _this.setOption(data);

            if (typeof options.callback == 'function') {
                options.callback(layer);
            };

        },
        isArray: function(data) {
            return Object.prototype.toString.call(data) === "[object Array]";
        },
        removeHandle: function() {
            if (this._extentHandle) {
                this._extentHandle.remove();
                this._extentHandle = null;
            };
            if (this._resizeHandle) {
                this._resizeHandle.remove();
                this._resizeHandle = null;
            };
        },
        removeLayer: function() {
            this.removeHandle();
            if (this.canvas) {
                this.canvas.parentNode.removeChild(this.canvas);
            }
        },
        hideLayer: function() {
            this.visible = false;
            this.canvas.style.display = 'none';
        },
        showLayer: function() {
            this.visible = true;
            this.canvas.style.display = 'block';
        }
    })
    return EchartsLayer;
});